From: Keir Fraser Date: Mon, 14 Dec 2009 07:45:04 +0000 (+0000) Subject: Pvrdtscp: move write_rdtscp_aux() to paravirt_ctxt_switch_to() - X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~12916 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=c16b168f1cd21cccb33964b2dae0bb5f482fb641;p=xen.git Pvrdtscp: move write_rdtscp_aux() to paravirt_ctxt_switch_to() - Currently write_rdtscp_aux() is placed in update_vcpu_system_time(), which is called by schedule() before context_switch(). This will break the HVM guest TSC_AUX state because at this point, MSR hasn't beed saved for HVM guests.So put the function in the point when a PV vcpu is really scheduled in. Signed-off-by: Dongxiao Xu --- diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 84493aba43..07d72fb37d 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -1298,6 +1298,10 @@ static void paravirt_ctxt_switch_to(struct vcpu *v) write_debugreg(6, v->arch.guest_context.debugreg[6]); write_debugreg(7, v->arch.guest_context.debugreg[7]); } + + if ( (v->domain->arch.tsc_mode == TSC_MODE_PVRDTSCP) && + boot_cpu_has(X86_FEATURE_RDTSCP) ) + write_rdtscp_aux(v->domain->arch.incarnation); } /* Update per-VCPU guest runstate shared memory area (if registered). */ diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c index cb8f1ff4ec..d474bb5038 100644 --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -832,10 +832,6 @@ static void __update_vcpu_system_time(struct vcpu *v, int force) else tsc_stamp = t->local_tsc_stamp; - if ( (d->arch.tsc_mode == TSC_MODE_PVRDTSCP) && - boot_cpu_has(X86_FEATURE_RDTSCP) ) - write_rdtscp_aux(d->arch.incarnation); - /* Don't bother unless timestamps have changed or we are forced. */ if ( !force && (u->tsc_timestamp == tsc_stamp) ) return;